//样本类,case class
//1.使用instanceof
//import caseClass.Apple
//import caseClass.Banana
//import caseClass.Fruit

class Fruit

class Apple(name: String) extends Fruit

class Banana(name: String) extends Fruit

//创建对象
var apple = new Apple("苹果")
var banana = new Banana("香蕉")
//判断对象是否是某个类的对象
println("apple是fruit:" + apple.isInstanceOf[Fruit])
println("apple是Apple:" + apple.isInstanceOf[Apple])
//println("apple是Banana:" + apple.isInstanceOf[Banana])
println("banana是fruit:" + banana.isInstanceOf[Fruit])


//2使用case class完成跟上面一样的功能
class Vehicle

case class Car() extends Vehicle

case class Bike() extends Vehicle

var car: Vehicle = new Car
car match {
  case Car() => println("汽车")
  case Bike() => println("自行车")
  case _ => println("载体")

}

//使用样本类可以创建SPARK SQL中的schema 表:DataFrame





